import {IndexParams } from "./recallInterface"
export class GlobalContext {
  private constructor() {
  }
  private static instance: GlobalContext;
  private _objects = new Map<string, Object>();
  public static getContext(): GlobalContext {
    if (!GlobalContext.instance) {
      GlobalContext.instance = new GlobalContext();
    }
    return GlobalContext.instance;
  }
  getObject(value: string): IndexParams {
    return this._objects.get(value) as IndexParams;
  }
  setObject(key: string, objectClass: IndexParams): void {
    this._objects.set(key, objectClass);
  }
}

export function getP(key: string = "indexParams"): IndexParams {
  return GlobalContext.getContext().getObject(key)
}
export function setP(objectClass: IndexParams, key: string = "indexParams"): void {
  GlobalContext.getContext().setObject(key, objectClass)
}
